<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
   <style>   
   </style>
</head>
<body>
    <button onclick="cdTime(fnOnclick, 2000)()">无畏冲锋</button>
</body>
<script>
  const fnOnclick = () =>{
    console.log("极地大作战已开启")
  };
  function cdTime(fn, delay) {
    let CD = false;
    return function () {
        console.log("1111");
        if (CD) {
            console.log("不行,cd中");
            return false;
        }
        CD = true;
        setTimeout (() => {
            console.log("冲啊");
            CD = false;
            fn();
        }, delay);
    }
    return function () {
         if(CD){
            return false
        }
    }
  }
</script>

</html>